#!/usr/bin/python
# -*- coding: utf-8 -*-

try:
    from gluon.contrib.gql import *
except:
    db=SQLDB('sqlite://db.db')
else:
    db=GQLDB()
    session.connect(request,response,db=db)

db.define_table("config",\
        SQLField("name"),\
        SQLField("appkey"),\
        SQLField("secret"),\
        SQLField("url"),\
        SQLField("v",'double')\
        )

db.config.name.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db,'config.name')]
db.config.appkey.requires=IS_NOT_EMPTY()
db.config.secret.requires=IS_NOT_EMPTY()
db.config.url.requires=[IS_NOT_EMPTY(), IS_URL()]
db.config.v.requires=IS_NOT_EMPTY()
